<template>
  <div>
    <!-- 头部全宽 -->
    <BaseHeader
      :navs="navs"
      :activeNav="activeNav"
      @nav-change="activeNav = $event"
    />
    <!-- banner全宽 -->
    <div class="full-width-bg banner-bg">
      <div class="banner-section">
        <el-carousel height="500px">
          <el-carousel-item v-for="item in bannerList" :key="item.id">
            <div
              class="banner-content"
              :style="{ backgroundImage: `url(${item.img})` }"
            >
              <div class="banner-text">
                <h1>{{ item.title }}</h1>
                <p>{{ item.desc }}</p>
              </div>
            </div>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>

    <!-- 1200安全区内容 -->

    <!-- 三大板块导航 -->
    <div class="section-nav">
      <div class="course-card-row">
        <div class="course-card">
          <div class="card-title">低空应用</div>
          <div class="card-desc">多元涵盖，知识拓展，思维丰富</div>
        </div>
        <div class="course-card">
          <div class="card-title">产教课程</div>
          <div class="card-desc">掌管中国民航规划、安全等多项事务</div>
        </div>
        <div class="course-card">
          <div class="card-title">职业技能</div>
          <div class="card-desc">聚焦航空器拥有者与驾驶员权益及业务的协会</div>
        </div>
      </div>
      <!-- <div
          class="nav-item"
          v-for="item in navItems"
          :key="item.id"
          @click="handleNavClick(item.id)"
        >
          <img :src="item.icon" :alt="item.title" />
          <h3>{{ item.title }}</h3>
          <p>{{ item.desc }}</p>
        </div> -->
    </div>

    <!-- 低空经济应用 -->
    <div class="container">
      <div class="low-altitude-section">
        <div class="section-title">
          <h2>低空经济应用</h2>
          <p>马空经济、智能未来，新型经济增长引擎，让无人机为城市赋能</p>
        </div>
        <!-- @mouseenter="hoverIndex = item.id"
            @mouseleave="hoverIndex = null" -->
        <div class="card-list">
          <div
            class="app-card"
            v-for="item in appList"
            :key="item.id"
            :class="{ active: hoverIndex === item.id }"
            @click="handleLowClick(item.id)"
          >
            <div class="card-img">
              <img :src="item.img" :alt="item.title" />
            </div>
            <div class="cont">{{ item.title }}</div>
          </div>
        </div>
      </div>
    </div>
    <!-- 产教课程 -->
    <div class="course-section">
      <div class="container">
        <div class="section-title">
          <h2>产教课程</h2>
          <p>
            解锁空天信息技术领域，共创产教融合新高地，在这里，每一次课程都是"产业实战教师培训"
          </p>
        </div>
        <div class="course-box">
          <div class="course-menu">
            <div
              v-for="c in courseList"
              :key="c.id"
              :class="['menu-item', { active: activeCourse === c.id }]"
              @click="handleCourseSelect(c.id)"
            >
              <img
                :src="
                  activeCourse == c.id
                    ? require('@/assets/index/down1.png')
                    : require('@/assets/index/down.png')
                "
                class="menu-icon"
              />
              {{ c.name }}
            </div>
          </div>
          <div class="course-detail">
            <h3>{{ currentCourse.name }}</h3>
            <p>{{ currentCourse.detail }}</p>
            <div class="course-btn">去上课</div>
          </div>
        </div>
      </div>
    </div>

    <!-- 职业技能 -->
    <div class="skill-section">
      <div class="section-title">
        <h2>职业技能</h2>
        <p>热门课程，让迷茫的你找到方向</p>
      </div>
      <div class="skill-box">
        <!-- <div class="container" style="display: flex"> -->
        <div class="skill-info">
          <h3>零基础全日制班</h3>
          <div class="skill-list">
            <div class="skill-item" v-for="item in skillList" :key="item.id">
              <img src="@/assets/index/check.png" alt="" class="skill-icon" />
              <span>{{ item.content }}</span>
            </div>
          </div>

          <div class="skill-btn" @click="goToSkillPage">了解更多</div>
        </div>
        <div class="skill-img">
          <img src="@/assets/index/drone-skill.png" />
        </div>
        <!-- </div> -->
      </div>
    </div>

    <!-- 新闻资讯 -->
    <div class="news-section">
      <div class="section-title section-titlebg">
        <h2>新闻资讯</h2>
        <p>最新最热的行业资讯</p>
      </div>
      <div class="container" style="margin-top: -90px">
        <div class="news-list">
          <!-- @mouseenter="hoverNews = news.id" -->
          <!-- @mouseleave="hoverNews = null" -->
          <div
            v-for="news in newsList"
            :key="news.id"
            class="news-card"
            @click="goToNews(news.id)"
            :class="{ active: hoverNews === news.id }"
          >
            <img :src="news.img" :alt="news.title" />

            <div class="news-info">
              <p class="news-date">{{ news.date }}</p>
              <h4>{{ news.title }}</h4>

              <p class="news-desc">{{ news.desc }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部全宽 -->
    <BaseFooter />
    <RightContact />
  </div>
</template>

<script>
import BaseHeader from "@/components/baseHeader.vue";
import BaseFooter from "@/components/baseFooter.vue";
import RightContact from "@/components/rightContact.vue";
export default {
  name: "Home",
  components: { BaseHeader, BaseFooter, RightContact },
  data() {
    return {
      navs: ["首页", "新闻", "题库", "资料", "产教课程"],
      activeNav: "首页",
      bannerList: [
        {
          id: 1,
          title: "产教课程",
          desc: "为企业输送适配人才、为学子搭建职业桥梁的创新课程",
          img: require("@/assets/index/banner.png"),
        },
        {
          id: 2,
          title: "低空经济应用",
          desc: "马空经济、智能未来，新型经济增长引擎，让无人机为城市赋能",
          img: require("@/assets/index/banner.png"),
        },
        // 添加更多轮播图...
      ],
      navItems: [
        {
          id: 1,
          title: "低空应用",
          desc: "智能化应用，无人机管理",
          icon: require("@/assets/index/drone-photo.png"),
        },
        {
          id: 2,
          title: "产教课程",
          desc: "专业课程体系，助力成长",
          icon: require("@/assets/index/drone-photo.png"),
        },
        {
          id: 3,
          title: "职业技能",
          desc: "职业技能培训，就业保障",
          icon: require("@/assets/index/drone-photo.png"),
        },
      ],
      hoverIndex: null,
      appList: [
        {
          id: 1,
          title: "航拍",
          img: require("@/assets/index/drone-photo.png"),
        },
        {
          id: 2,
          title: "巡检",
          img: require("@/assets/index/drone-inspect.png"),
        },
        {
          id: 3,
          title: "编队表演",
          img: require("@/assets/index/drone-show.png"),
        },
        {
          id: 4,
          title: "植保",
          img: require("@/assets/index/drone-agriculture.png"),
        },
      ],
      activeCourse: 1,
      courseList: [
        {
          id: 1,
          name: "零基础全日制班",
          detail:
            "能飞·无人机周末班，致力于为热爱无人机、拥有飞行梦想、在工作日没有时间，不能脱产学习的学员提供一个实现梦想的机会。周末班采取独特的阶段式教学法，累计通过十四周的培训学习，模拟考试合格之后，就可以安排参加考试。学习时间可根据学员自身的情况灵活安排，适合想周末提升自己的上班族。",
        },
        {
          id: 2,
          name: "垂直起降课程",
          detail: "适合初学者的入门课程...",
        },
        // 添加更多课程...
      ],
      currentCourse: {},
      skillList: [
        {
          id: 1,
          content:
            "特点一：多旋翼无人机拥有体积小、重量轻、噪音小、隐蔽性好，适合多平台，多空间使用；",
        },
        {
          id: 2,
          content:
            "特点二：可以垂直起降，不需要弹射器、发射架进行发射，可悬停、侧飞、倒飞；飞行高度低，具有很强的机动性，执行特种任务能力强；",
        },
        {
          id: 3,
          content:
            "特点三：结构简单控制灵活，成本低，螺旋桨小，安全性好，拆卸方便，且易于维护等诸多优点，广泛应用于教育科研领域、航拍领域、军用领域、警用安全领域、农业领域等领域；",
        },
      ],
      newsList: [
        {
          id: 1,
          title: "无人机管理新规定",
          date: "2024-01-15",
          desc: "考无人机等照很难吗？其实比你很象的简单！了解考证难度与备考建议，轻松成为专业飞手...",
          img: require("@/assets/index/drone-photo.png"),
        },
        {
          id: 2,
          title: "玩无人机需要考证吗？",
          date: "2024-01-15",
          desc: "本文详细解读了玩无人机是否需要考证的问题，涵盖娱乐性飞行、商业用途，考证好处及操作证种类等内容，帮助无...",
          img: require("@/assets/index/drone-photo2.png"),
        },
        {
          id: 3,
          title: "【总结】2020年上半年 我国无人机获六⋯",
          date: "2024-01-15",
          desc: "作为新兴智能产业，近年来无人机在我国的发展十分快速消费级和工业级应用大门的开肩，更是助推了无人机商用...",
          img: require("@/assets/index/drone-photo3.png"),
        },
      ],
      hoverNews: null,
      footerMenus: [
        {
          title: "新手指南",
          items: [
            { id: 1, text: "注册登录", link: "#" },
            { id: 2, text: "关于我们", link: "#" },
            { id: 3, text: "实践课程", link: "#" },
          ],
        },
        // 添加更多底部菜单...
      ],
    };
  },
  methods: {
    handleNavClick(id) {
      // 导航点击处理
    },
    handleTabClick(tab) {
      // Tab切换处理
    },
    handleLowClick(id) {
      this.$router.push({
        path: "/low",
        query: { id: id },
      });
    },
    handleCourseSelect(id) {
      this.activeCourse = id;
      this.currentCourse = this.courseList.find((course) => course.id === id);
    },
    goToSkillPage() {
      // 跳转到技能页面
      this.$router.push("/skill");
    },
    goToNews(id) {
      console.log(32);
      // 跳转到新闻详情
      this.$router.push({
        path: "/newsDetail",
        query: { id: id },
      });
    },
  },
  created() {
    // 初始化当前课程
    this.currentCourse = this.courseList[0];
  },
};
</script>
<style>
.el-carousel__indicators {
  display: flex !important;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
  gap: 24px;
}

.el-carousel__indicators {
  display: flex !important;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
  gap: 24px;
  position: absolute;
  bottom: 145px;
  left: 416px;
}

.el-carousel__indicator {
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}

.el-carousel__indicator {
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}

.el-carousel__button {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #e0e3e9;
  transition: background 0.3s;
  margin: 0 4px;
  opacity: 1 !important;
}

.el-carousel__button {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #e0e3e9;
  transition: background 0.3s;
  margin: 0 4px;
  opacity: 1 !important;
}

.el-carousel__indicator.is-active .el-carousel__button {
  background: #2176ff;
}

.el-carousel__indicator.is-active .el-carousel__button {
  background: #2176ff;
}
</style>
<style scoped lang="scss">
.container {
  width: 1200px;
  margin: 0 auto;
}

.header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  height: 60px;
  line-height: 60px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
}

.logo {
  margin-right: 12px;
  width: 32px;
  height: 32px;
  background: #d8d8d8;
  border-radius: 50%;
}

.platform-name {
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.nav-list {
  display: flex;
  gap: 40px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  font-size: 16px;
  font-weight: 500;
  color: #222;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-list li:nth-child(3) {
  margin-left: 400px;
}

.nav-list li.active,
.nav-list li:hover {
  color: #409eff;
}

.login-btn {
  width: 98px;
  height: 60px;
  background: #1664ff;
  font-size: 16px;
  border-radius: 0;
}

.banner-section {
}

.banner-content {
  height: 100%;

  background-size: cover;
  background-position: center;
  display: flex;
  // align-items: center;
  // padding: 0 100px;
}

.banner-text {
  width: 1200px;
  margin: 0 auto;
  padding-top: 120px;
  text-align: left;
}

.banner-text h1 {
  font-size: 42px;
  font-weight: bold;
  color: #333;
}

.banner-text p {
  font-size: 16px;
  color: #41464f;
}

.section-nav {
  display: flex;
  justify-content: space-around;
  margin-top: -50px;
  position: relative;
  z-index: 9;
}

.nav-item {
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.nav-item:hover {
  transform: translateY(-5px);
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.low-altitude-section {
  margin: 60px 0;
}

.card-list {
  display: flex;
  justify-content: space-between;
  gap: 0;
}

.app-card {
  width: 285px;
  height: 285px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
  box-shadow: 0 2px 12px #e6eefa;
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.app-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 32px #409eff22;
}

.card-img img {
  width: 100%;
  height: 285px;
  object-fit: cover;
}

.app-card .cont {
  font-weight: 600;
  font-size: 22px;
  color: #12192d;
  position: absolute;
  bottom: 0;
  width: 285px;
  height: 62px;
  line-height: 62px;
  background: linear-gradient(#ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
  box-shadow: 0px 2px 12px 0px #e1e3eb;
  border-radius: 12px;
  border: 1px solid #ffffff;
}

.course-section {
  background: #f5f7fd;
  padding: 80px 0;
}

.course-box {
  display: flex;

  border-radius: 12px;
}

.course-menu {
  width: 336px;
  margin-right: 30px;
  text-align: left;
}

.menu-icon {
  width: 28px;
  height: 28px;
  margin-right: 20px;
  vertical-align: middle;
}

.menu-item {
  padding: 18px 32px;
  cursor: pointer;
  font-size: 16px;
  color: #222;
  // transition: background 0.2s, color 0.2s;
}

.menu-item.active {
  color: #fff;
  font-weight: bold;
  width: 336px;
  height: 56px;
  background: #1664ff;
  border-radius: 8px;
  text-align: left;
}

.course-detail {
  width: 834px;
  padding: 40px 48px;
  background: #fff;
  box-shadow: 0 4px 24px #e6eefa;
  text-align: left;
  box-shadow: 0px 2px 12px 0px #e1e3eb;
  border-radius: 8px;
}

.course-btn {
  width: 172px;
  height: 40px;
  background: #1664ff;
  border-radius: 6px;
  text-align: center;
  line-height: 40px;
  color: #fff;
}

.course-detail h3 {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 18px;
}

.course-detail p {
  color: #666;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  display: -moz-box;
  /* 兼容Firefox */
  -moz-box-orient: vertical;
  -moz-line-clamp: 3;
  display: box;
  /* 兼容旧版Opera */
  box-orient: vertical;
  line-clamp: 3;
}

.skill-section {
  padding: 60px 0;
}

.skill-box {
  width: 1200px;
  margin: 0 auto;
  display: flex;
  background: linear-gradient(90deg, #f6f9fe 60%, #e6f0ff 100%);
  border-radius: 12px;
  box-shadow: 0 4px 24px #e6eefa;
}

.skill-info {
  width: 474px;
  height: 511px;
  background: #ffffff;
  border-radius: 12px 0px 0px 12px;
  border: 1px solid #ffffff;
  padding: 20px 40px;
}

.skill-icon {
  width: 20px;
  vertical-align: middle;
  margin-right: 10px;
}

.skill-info h3 {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 18px;
  text-align: left;
}

.skill-list .skill-item {
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 15px;
  color: #12192d;
  line-height: 21px;
  text-align: left;
  margin-top: 30px;
}

.skill-btn {
  width: 172px;
  height: 40px;
  background: #1664ff;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  line-height: 40px;
  margin-top: 70px;
  cursor: pointer;
}

.skill-img {
  width: 764px;
  height: 511px;
  background: linear-gradient(293deg, #edebff 0%, #f8fcff 100%);
  // box-shadow: 0px 2px 12px 0px #e1e3eb;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skill-img img {
  width: 546px;
  border-radius: 8px;
}

.news-section {
  padding: 60px 0;
  position: relative;
}

.section-titlebg {
  width: 100%;
  height: 311px;
  background: linear-gradient(180deg, #1664ff 0%, #53b4ff 100%);
  padding-top: 80px;
  color: #fff;
}

.news-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  padding: 0 50px;
}

.news-card {
  width: 386px;
  height: 446px;
  background: #fafbff;
  box-shadow: 0px 4px 60px 0px rgba(0, 69, 207, 0.08);
  border-radius: 12px;
  cursor: pointer;
  padding: 24px 24px;
  transition: all 0.3s;
}

.news-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.news-info {
  text-align: left;
}

.news-date {
  font-weight: 400;
  font-size: 12px;
  color: #41464f;
}

.news-desc {
  font-weight: 400;
  font-size: 14px;
  color: #41464f;
  line-height: 20px;
  text-align: justify;
}

.footer {
  background: #3482f4;
  color: #fff;
  height: 414px !important;
  padding: 60px 50px 30px;
}

.footer h4 {
  margin-bottom: 20px;
}

.footer ul {
  list-style: none;
  padding: 0;
}

.footer ul li {
  margin-bottom: 10px;
}

.footer ul li a {
  color: #fff;
  text-decoration: none;
}

.footer-bottom {
  margin-top: 40px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

.course-card-row {
  display: flex;
  justify-content: space-between;
  gap: 32px;
}

.course-card {
  width: 386px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px #e6eefa;
  padding: 24px 24px;
  text-align: left;
  transition: box-shadow 0.3s, transform 0.3s;
  cursor: pointer;
}

.course-card:hover {
  box-shadow: 0 8px 32px #409eff22;
  transform: translateY(-5px);
}

.card-title {
  font-size: 20px;
  font-weight: bold;
  color: #222;
  margin-bottom: 12px;
}

.card-desc {
  color: #666;
  font-size: 15px;
}
</style>
